//方法2
//使用算法库reverse()

#include<iostream>
#include<algorithm>
#include<vector>

using namespace std;

//   Definition for singly-linked list.
  struct ListNode {
      int val;
      ListNode *next;
      ListNode(int x) : val(x), next(NULL) {}
 };

 class Solution {
public:
    vector<int> reversePrint(ListNode* head) 
    {
        vector<int> tmp;
        ListNode* cur=head;
        while(cur)
        {
            tmp.push_back(cur->val);
            cur=cur->next;
        }
        reverse(tmp.begin(),tmp.end());
        return tmp;
    }
};
